﻿/*****************************************************************//**
 * @file    FITKGraphObjectConstraintRigidBody.h
 * @brief   Graph object for 'rigid body'.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-05-17
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTCONSTRAINTRIGIDBODY_H__
#define __FITKGRAPHOBJECTCONSTRAINTRIGIDBODY_H__

#include "FITKGraphObjectInteractionBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkPoints;
class vtkCellArray;
class vtkDoubleArray;
class vtkPolyData;

namespace Interface
{
    class FITKInteractionLocation;
    class FITKAbaConstraintRigidBody;
}

namespace Exchange
{
    /**
     * @brief   Graph object for 'rigid body'.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-05-17
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectConstraintRigidBody : public FITKGraphObjectInteractionBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectConstraintRigidBody, FITKGraphObjectInteractionBase);
        FITKCLASS(Exchange, FITKGraphObjectConstraintRigidBody);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   rigidData: The rigid body data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-17
         */
        FITKGraphObjectConstraintRigidBody(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaConstraintRigidBody* rigidData);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-17
         */
        ~FITKGraphObjectConstraintRigidBody() = default;

        /**
         * @brief   Update all graph actors.[override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        void update(bool forceUpdate = false) override;

        /**
         * @brief   If the graph object has relation with the given data object id.[override]
         * @param   dataObjId: The data object id
         * @return  Has relation
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-24
         */
        bool isRelatedTo(int dataObjId) override;

    protected:
        /**
         * @brief   Initialize.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-17
         */
        void init() override;

        /**
         * @brief   Generate the poly data for the rigid body.[override]
         * @param   constraint: The constraint data object
         * @return  Is OK
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-17
         */
        bool generatePolyData(Interface::FITKInteractionLocation* constraint) override;

        /**
         * @brief   Generate rigid body actor.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-17
         */
        void generateGraph() override;

        /**
         * @brief   Clear the data.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-24
         */
        void clearData() override;

    private:
        /**
         * @brief   The location's set or surface id 1.( Set or surface )
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        int m_locationCompId_3 = -1;

        /**
         * @brief   The location's set or surface id 2.( Set or surface )
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        int m_locationCompId_4 = -1;

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTCONSTRAINTRIGIDBODY_H__
